package org.raymond.iworks;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@EnableAsync
@EnableTransactionManagement
@EnableDiscoveryClient
@EnableFeignClients
@SpringBootApplication
@EnableJpaAuditing
public class AdminApplication {
    public static void main(String[] args) throws UnknownHostException {
        SpringApplication springApplication = new SpringApplication(AdminApplication.class);
        //springApplication.addListeners(new AppPropertiesPreparedListener());
        springApplication.run(args);
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = System.getProperty("server.port");
        String path = System.getProperty("server.servlet.context-path");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application Admin is running! Access URLs:\n\t" +
                "Local: \t\thttp://:" + ip + ":" + port + path + "/\n\t" +
                "External: \thttp://" + ip + ":" + port + path + "/\n\t" +
                "----------------------------------------------------------");
    }
}
